package sis.studentinfo;

/**
 * Created by IntelliJ IDEA.
 * User: alexander-kalden
 * Date: 9/14/12
 * Time: 1:34 PM
 * To change this template use File | Settings | File Templates.
 */
public class Performance {

    private int[] tests = {};

    public void setNumberOfTests(int numberOfTests) {
        tests = new int[numberOfTests];
    }

    public void set(int testNumber, int score) {
        tests[testNumber] = score;
    }

    public int get(int testNumber) {
        return tests[testNumber];
    }

    public double average() {
        if (tests.length == 0)
            return 0.0;
        int total = 0;
        for (int score: tests)
            total += score;
        return (double)total / tests.length;
    }
}
